package com.feicheng.lanniao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.ICarBuyClientVoService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-09-07
 */
@RestController
@RequestMapping("/lanniao-admin/car-buy-info")
public class CarBuyInfoController {

	@Autowired
	ICarBuyClientVoService iCarBuyClientVoService;
	/**
	 * 查询所有买车信息集合
	 * @param title 标题
	 * @param details 详情
	 * @param clientId 用户ID
	 * @param currentPage 当前页
	 * @param pageSize 每页分多少条
	 * @return 买车信息集合
	 */
	@GetMapping("/page")
	public ResultInfo getCarBuyClientVoList(String title,String details, Integer clientId,
			@RequestParam(required = false, defaultValue = "1") Integer currentPage,
			@RequestParam(required = false, defaultValue = "5") Integer pageSize) {
		return iCarBuyClientVoService.getCarBuyClientVoList(title, details, clientId, currentPage, pageSize);
	}
	/**
	 * 删除买车信息
	 * @param cbId 买车信息ID
	 * @return boolean值
	 */
	@PutMapping("/info")
	public ResultInfo deleteBuyCar(Integer cbId) {
		return iCarBuyClientVoService.deleteCarBuyInfo(cbId);
	}

}
